package com.huarui.companypackage.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.ewaf.framework.dao.impl.BaseDaoImpl;
import org.ewaf.framework.model.PagingSummary;

import com.huarui.companypackage.dao.IServiceDao;
import com.huarui.companypackage.model.Service;

public class ServiceDaoImpl extends BaseDaoImpl implements IServiceDao {

	@SuppressWarnings("unchecked")
	public List<Service> selectServices(Service service,
			PagingSummary summary) {
		HashMap<String, Object> params = new HashMap<String, Object>();
		params.put("start", summary.getStart());
		params.put("limit", summary.getLimit());
		return (List<Service>) getSqlMapClientTemplate().queryForList(
				namespace + ".selectServices", params);
	}

	public int selectServicesCount(Service service) {
		HashMap<String, Object> params = new HashMap<String, Object>();
		return (Integer) getSqlMapClientTemplate().queryForObject(
				namespace + ".selectServicesCount", params);

	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Service> getSelectableService(Integer selectable) {
		
		return getSqlMapClientTemplate().queryForList(namespace+".getSelectableService", selectable);
	}

	
	@Override
	public Service getServiceById(Integer serviceId) {
		
		return (Service) getSqlMapClientTemplate().queryForObject(namespace+".getServiceById", serviceId);
	}

}
